package com.zcy.dynamic;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.context.annotation.Configuration;

/**
 * Created by join on 2017/6/28.
 */
@Configuration
public class DynamicBeanDefinitionRegistryPostProcessor implements BeanDefinitionRegistryPostProcessor {

    public static BeanDefinitionRegistry registry;
    public static ConfigurableListableBeanFactory beanFactory;

    @Override
    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
        DynamicBeanDefinitionRegistryPostProcessor.registry = registry;
    }

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        DynamicBeanDefinitionRegistryPostProcessor.beanFactory = beanFactory;
    }
}
